// pages/grcenter/grcenter.js
import config from './../../config';
import {
    message,
    session,
    getOpenId,
} from './../../utils/helper';
import {
    getDashboard,
} from './../../services/grcenter';

//获取应用实例
const app = getApp();
//实例化本地缓存
const cookie = new session();

Page({
    //页面的初始数据
    data: { 
        data: {}
    },

    //事件处理函数
    onLoad: function() {
        //显示当前页面的转发按钮
        wx.showShareMenu({
            withShareTicket: true
        });
        getOpenId(openid=>{
            let that = this,
                param = {
                    'openid': openid
                };
            //获取幻灯片图片
            getDashboard(param, {
                success: res => {
                    that.setData({
                        data: res.data
                    });
                }
            });
        });
    },

    //下拉刷新事件
    onPullDownRefresh() {
        this.onLoad();
        wx.stopPullDownRefresh();
    },

    //跳转到我的咨询页面的最新模块
    tiao_new: function() {
        wx.navigateTo({
            url: '../my_ask/my_ask?activeIndex=0'
        })
    },

    //跳转到我的咨询页面的待付款模块
    tiao_paying: function () {
        wx.navigateTo({
            url: '../my_ask/my_ask?activeIndex=1'
        })
    },

    //跳转到我的咨询页面的待评价模块
    tiao_judgeing: function () {
        wx.navigateTo({
            url: '../my_ask/my_ask?activeIndex=2'
        })
    },

    //跳转到我的支付页面
    tiao_my_pay: function() {
        wx.navigateTo({
            url: '../my_pay/my_pay'
        })
    },

    //跳转到绑定手机页面
    bindcall: function() {
        wx.navigateTo({
            url: '../center_bindcall/center_bindcall'
        })
    },

    //跳转到我的消息页面
    tiao_myMessage: function() {
        wx.navigateTo({
            url: '../my_message/my_message'
        })
    },

    //跳转到我的客服页面
    tiao_myKefu: function () {
        wx.navigateTo({
            url: '../my_kefu/my_kefu'
        })
    },

    //律师入驻
    tiao_lawyer(){
        wx.navigateTo({
            url: '../ls/ls'
        })
    }
})